﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tasks.Common;
using System.Configuration;

namespace Tasks.API
{
    public class SMSAPI
    {
        /// <summary>
        /// 发送短信息
        /// </summary>
        /// <param name="mobileNo"></param>
        /// <param name="content"></param>
        /// <returns></returns>
        public static bool SendSMS(string mobileNo, string content)
        {
            try
            {
                wsServiceCenter.WebServiceSoapClient ws = new wsServiceCenter.WebServiceSoapClient();
                wsServiceCenter.ExecuteResult result = ws.SendSMS("", mobileNo, content);

                if (result.ResultNo == 1)
                    return true;
                else
                {
                    string err = string.Format("发送短信失败 {0} 内容 {1}   接口返回代码：{2}", mobileNo, content, result.ResultNo + " || " + result.Message);
                    Log.WriteLog(err);

                    return false;
                }
            }
            catch (Exception ex)
            {
                Log.WriteLog(ex);
                return false;
            }
        }

    }
}
